//Source file: D:\\test\\com\\ce\\pms\\charge\\model\\AbstractSubAccount.java

package com.ce.pms.charge.model;

import java.math.BigDecimal;

import javax.persistence.*;

import com.sitechasia.webx.core.model.IDomainObject;
/**
 * 账户类型: 001物业帐户;002预交款帐户;003保证金帐户
 * @function 子帐户
 * @author Adama Yue
 * @CreateDate:2008-7-11
 */
@Entity
@Table(name = "FEE_SUB_ACCOUNT")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "ACCOUNT_TYPE", discriminatorType = DiscriminatorType.STRING)
abstract public class AbstractSubAccount implements IDomainObject{

	/**
	 * 主键
	 */
	@Id
	@GeneratedValue
	@Column(name = "SUB_ACCOUNT_ID",nullable=false)
	private Long subAccountId;

	/**
	 * 账户
	 */
	@ManyToOne(cascade={},fetch=FetchType.LAZY)
	@JoinColumn(name="ACCOUNT_ID",nullable=false)
	private AccountDomain account;

//	/**
//	 * 账户类型: 001物业帐户;002预交款帐户;003保证金帐户
//	 */
//	private String accountType;

	/**
	 * 余额
	 */
	@Column(name="BALANCE",precision=18,scale=2,nullable=false)
	private BigDecimal balance = new BigDecimal("0.00");

	/**
	 * 帐户锁定状态第一位表示借; 第二为表示贷. 0表示正常;1表示锁定
            00表示正常
            10表示锁定借
            01表示锁定贷
            11表示同时锁定借和贷'
	 */
	@Column(name="LOCK_STATE",length=3,nullable =false)
	private String lockState = "00";

	/**
	 * @roseuid 48757D0F030D
	 */
	public AbstractSubAccount() {
	}

	public AbstractSubAccount(AccountDomain account, BigDecimal balance) {
		super();
		this.account = account;
		this.balance = balance;
	}

	/*********************************************
	 * Accessors and modifiers
	 *********************************************/
	public AccountDomain getAccount() {
		return account;
	}

	public void setAccount(AccountDomain account) {
		this.account = account;
	}

	public BigDecimal getBalance() {
		return balance;
	}

	public void setBalance(BigDecimal balance) {
		this.balance = balance;
	}

	/**
	 * @return the subAccountId
	 */
	public Long getSubAccountId() {
		return subAccountId;
	}

	/**
	 * @param subAccountId the subAccountId to set
	 */
	public void setSubAccountId(Long subAccountId) {
		this.subAccountId = subAccountId;
	}

	public String getLockState() {
		return lockState;
	}

	public void setLockState(String lockState) {
		this.lockState = lockState;
	}

}
